package com.zhdl.hardware_contact.hardware_param.service.impl;

import com.project.common.service.impl.BaseServiceImpl;
import com.zhdl.hardware_contact.hardware_param.entity.HardwareDictionary;
import com.zhdl.hardware_contact.hardware_param.repository.HardwareDictionaryDao;
import com.zhdl.hardware_contact.hardware_param.service.HardwareDictionaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

@Slf4j
@Service
public class HardwareDictionaryServiceImpl extends BaseServiceImpl<Integer, HardwareDictionary, HardwareDictionaryDao> implements HardwareDictionaryService {

    @Resource
    private HardwareDictionaryDao hardwareDictionaryDao;

    public HardwareDictionary findHardwareDictionaryById(Integer id) {
        Optional<HardwareDictionary> byId =
                hardwareDictionaryDao.findById(id);
        return byId.orElse(null);
    }

    public List<HardwareDictionary> HardwareInfoByworkplaceId(Integer workplaceId){
        return hardwareDictionaryDao.HardwareInfoByworkplaceId(workplaceId);
    }

    @Override
    public HardwareDictionary findHardwareDictionaryByName(String Name) {
        return hardwareDictionaryDao.findHardwareDictionaryByName(Name);
    }

}
